package designMode.compoundPattern;

/**
 * @author LIBOFEI
 * @ClassName GooseAdapter
 * @description 这是鹅伪装成鸭子的适配器，他实现鸭子呱呱呱叫接口，并把呱呱呱叫转化为自己的咯咯咯叫
 * @date 2020/7/1 14:37
 * @Version 1.0
 **/
public class GooseAdapter implements Quackable{

    private Goose goose;

    Observable observable;

    public GooseAdapter(Goose goose){
        this.goose = goose;
        observable = new Observable(this);
    }

    @Override
    public void quack() {
        goose.honk();
    }

    @Override
    public void registerObserver(Observer observer) {
        observable.registerObserver(observer);
    }

    @Override
    public void notifyObservers() {
        observable.notifyObservers();
    }
}
